//
//  DoctorViewController.m
//  QuickCure
//
//  Created by 曹魏 on 16/9/15.
//  Copyright © 2016年 haoge. All rights reserved.
//

#import "DoctorMessageViewController.h"
#import "DoctorMsgHeadView.h"
#import "CWBackViewController.h"

@interface DoctorMessageViewController ()

@property (nonatomic,weak)DoctorMsgHeadView *headView;
@property (nonatomic,strong)CWBackViewController *backViewController;

@property (nonatomic,assign)BOOL isCollected;


@end

@implementation DoctorMessageViewController
- (CWBackViewController *)backViewController
{
    if(!_backViewController)
    {
        _backViewController = [[CWBackViewController alloc]init];
    }
    return _backViewController;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.translucent = NO;

    [self setupUI];
    
    self.navigationItem.title = @"医生基本信息";
    UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 40, 40)];
    [btn setImage:[UIImage imageNamed:@"kongxin"] forState:UIControlStateNormal];
    [btn setImage:[UIImage imageNamed:@"shixin"] forState:UIControlStateHighlighted];
    
    UIBarButtonItem *rightBarBtnItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"kongxin"] style:UIBarButtonItemStylePlain target:self action:@selector(rightBarBItemClick:)];
    self.navigationItem.rightBarButtonItem = rightBarBtnItem;
    

}
- (void)rightBarBItemClick:(UIBarButtonItem *)item
{
    if(self.isCollected)
    {
        item.image = [UIImage imageNamed:@"kongxin"];
    }else
    {
        item.image = [UIImage imageNamed:@"shixin"];
    }
    self.isCollected = !self.isCollected;
}

- (void)setupUI
{
    self.view.backgroundColor = [UIColor whiteColor];
    //上方UIView:
    DoctorMsgHeadView *head = [[DoctorMsgHeadView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 140)];
    head.doctorModel = self.doctorModel;
    [self.view addSubview:head];
    [head setBackgroundColor:[UIColor colorWithWhite:0.973 alpha:1.000]];
    //灰色分割线:
    UIView *grayView = [[UIView alloc]init];
    [head addSubview:grayView];
    [grayView setBackgroundColor:[UIColor colorWithWhite:0.886 alpha:1.000]];
    
    [grayView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@5);
        make.leading.equalTo(head);
        make.bottom.trailing.equalTo(head).offset(0);
    }];
    
    
    //下方联动view:
    UIView *bottomView = [[UIView alloc]init];
    [self.view addSubview:bottomView];

    [bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(head.mas_bottom);
        make.trailing.equalTo(self.view);
        make.leading.equalTo(self.view);
        make.bottom.equalTo(self.view);

    }];
    
    [bottomView addSubview:self.backViewController.view];
    
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    self.navigationController.navigationBar.translucent = YES;
}

@end










